﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BanVeXemPhim_Presentation
{
    public enum GheState : int
    {
        DACHON,
        CHUACHON,
        DANGCHON
    }

    public partial class UserControlGheNgoi : UserControl
    {

        public UserControlGheNgoi()
        {
            InitializeComponent();
            
        }
        private int _hang;
        private int _cot;
        private int _idGhe;
        private GheState _tinhTrang=GheState.CHUACHON;

        public int Hang
        {
            get { return _hang; }
            set { _hang = value; }
        }

        public int Cot
        {
            get { return _cot; }
            set { _cot = value; }
        }

        public GheState TinhTrang
        {
            get { return _tinhTrang; }
            set
            {
                _tinhTrang = value;
                if(_tinhTrang==GheState.CHUACHON)
                {
                    this.pictureBox1.Image = Properties.Resources.GheTrong;
                }
                else if(_tinhTrang==GheState.DACHON)
                {
                    this.pictureBox1.Image = Properties.Resources.DaBan;
                }
            }
        }

        public int IdGhe
        {
            get { return _idGhe; }
            set { _idGhe = value; }
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if(TinhTrang==GheState.CHUACHON)
            {
                _tinhTrang = GheState.DANGCHON;
                this.pictureBox1.Image = Properties.Resources.DangChon;
            }
            else if(TinhTrang==GheState.DANGCHON)
            {
                _tinhTrang = GheState.CHUACHON;
                this.pictureBox1.Image = Properties.Resources.GheTrong;
            }
            
        }

        private void pictureBox1_MouseHover(object sender, EventArgs e)
        {
            toolTip1.SetToolTip(this.pictureBox1, "Hàng:" + _hang.ToString() + "\n" + "Cột:"+_cot.ToString());
        }

    }
}
